Skip to content

Instantly share code, notes, and snippets.

@fakenickels
Last active September 6, 2017 02:40
Show Gist options
  • Save fakenickels/b0720a1e0b8451204f6f89594ba59bc8 to your computer and use it in GitHub Desktop.
Save fakenickels/b0720a1e0b8451204f6f89594ba59bc8 to your computer and use it in GitHub Desktop.
import React from 'react'
import { View, Text, Modal } from 'react-native'
import withState from './withState'
const ViewUsingModal = ({ isModalVisible, toggleModalVisibility, isLoading }) =>
<View>
<TouchableOpacity onPress={toggleModalVisibility}>
<Text>Tap me!</Text>
</TouchableOpacity>
<Modal visible={isModalVisible}>
<View>
<Text>I am alive!</Text>
</View>
</Modal>
</View>
const withModal = withState('isModalVisibile', 'setModalVisibility', false)
const withLoading = withState('isLoading', 'setIsLoading', false)
export default withLoading(withModal((ViewUsingModal)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment