shimohq / react-native-prompt-android

A polyfill library for Alert.prompt on Android platform, working both on Android and iOS platform.
MIT License
129 stars 74 forks source link

Trigger the prompt with an onpress #57

Open OmarOdaini opened 4 years ago

OmarOdaini commented 4 years ago

I need to ask user for input onPress. Obviously this code doesn't work but I want something like that:


const Newact = (props) => {
    return(
        <View>
            <View style={styles.button} >
            <TouchableOpacity  style={styles.center} onPress= {prompt = ('','',
                  [
                  {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
                  {text: 'OK', onPress: password => console.log('OK Pressed, password: ' + password)},
                  ],
                  {
                      type: 'secure-text',
                      cancelable: false,
                      defaultValue: '',
                      placeholder: 'placeholder'
                  }
              )}>
                    <Text style={styles.plusSign}>+</Text>
                    </TouchableOpacity>
            </View>
        </View>
    );
}