react-native-modal-picker icon indicating copy to clipboard operation
react-native-modal-picker copied to clipboard

Not working on Android 5.0

Open ja-ah opened this issue 9 years ago • 2 comments

not working on Android 5.0 with react native > 29

ja-ah avatar Aug 20 '16 17:08 ja-ah

I have the same problem. using

<ModalPicker data={data} initValue="Select something yummy!" onChange={(option)=>{ this.setState({textInputValue:option.label})}}>

           <TextInput
                    style={{borderWidth:1, borderColor:'#ccc', padding:10, height:30}}
                    editable={false}
                    placeholder="Select something yummy!"
                    value={this.state.textInputValue} />

but I solve it to delete TextInput , In Ios the sample it's work. In Android I guess the TextInput mask the origin onPress event.

ps. sorry I don't know why the editor will eat my <ModalPicker

Jackyen avatar Sep 08 '16 08:09 Jackyen

If you really need to use this TextInput you can resolve this problem by wrapping ModalPicker and TextInput in one container as siblings, and give them absolute position to the containe, with proper opacity and zIndex:


<View style={modalStyles.selectModalContainer}>
    <ModalPicker
        data={data}
        style={modalStyles.selectModalComponent}
        initValue="Select something yummy!"
        onChange={(option)=>{ this.setState({textInputValue:option.label})}}
     />

    <TextInput
        style={modalStyles.inputStyleSelectModal}
        editable={false}
        placeholder="Select something yummy!"
        value={this.state.textInputValue}
       />
</View>


const modalStyles = StyleSheet.create({
  selectModalContainer: {
    position: 'relative',
    width: 200,
    height: 30,
  },
  selectModalComponent: {
    position: 'absolute',
    opacity: 0,
    width: 200,
    zIndex: 2,
  },
  inputStyleSelectModal: {
    position: 'absolute',
    textAlign: 'right',
    width: 200,
    height: 30,
    zIndex: 1
  }
});

Sandx3 avatar Feb 14 '17 12:02 Sandx3