Button into modal doesn't work on iOS

Hi,
I have a problem of compatibility between android and iOS :
the code below works well on Android, but not in iOS standalone App :frowning:
This code is in a Picker.ios.js file. I tried it with Picker.android.js and it perfectly works, so I can’t understand the iOS logic…


import Modal from 'react-native-modal';
[…]
  render() {
    return (
      <View>
        <TouchableOpacity
          disabled={!this.props.enabled}
          onPress={() => this.setState({ modalVisible: true })}
          style={this.props.style}
        >
          <Text style={styles.text}>{'Hello'}</Text>
        </TouchableOpacity>

        <Modal
          isVisible={this.state.modalVisible}
        >
          <View style={{
            backgroundColor: 'white',
            borderRadius: 4,
            elevation: 2,
            padding: 16,
            borderColor: 'rgba(0, 0, 0, 0.1)',
          }}
          >
            {
              this.props.values.map((value, index) => (
                <TouchableHighlight
                  key={value}
                  style={{ marginBottom: 12 }}
                  underlayColor="transparent"
                  onPress={() => {
                    this.props.onValueChange(value);
                    this.setState({ modalVisible: false, selected: (this.props.labels && this.props.labels[index]) || translate(value) });
                  }}
                >
                  <Text style={styles.textButton}>{'Picker'}</Text>
                </TouchableHighlight>
              ))
            }
            <Divider />

            <TouchableHighlight

              style={{ marginBottom: 12 }}
              underlayColor="transparent"
              onPress={() => {
                this.setState({ modalVisible: false });
              }}
            >
              <Text style={[styles.textButton, { color: colour.error }]}>Cancel</Text>
            </TouchableHighlight>
          </View>
        </Modal>
      </View>
    );
  }

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.