Skip to content

Instantly share code, notes, and snippets.

@AllanGraves
Created February 4, 2021 18:52
Show Gist options
  • Save AllanGraves/8cf39d07559fd491321f345b2c93cde2 to your computer and use it in GitHub Desktop.
Save AllanGraves/8cf39d07559fd491321f345b2c93cde2 to your computer and use it in GitHub Desktop.
Context Consumer
const InputModal = {variableIndex} => {
const keyText = useContext(LocationContext);
return(
<TouchableHighlight
style={styles.openButton}
onPress={() => {
//console.log('modalText: ' + modalText);
changeText(modalText);
setModalVisible(!modalVisible);
console.log('keyText: ' + keyText[variableIndex]);
keyText[variableIndex] = modalText;
console.log('keyText2: ' + keyText[variableIndex]);
mergeData(storyID, variableIndex, modalText);
}}>
<Text style={styles.textStyle}>OK</Text>
</TouchableHighlight>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment