This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import store from './reduxStore'; | |
import React from 'react'; | |
import { Provider } from 'react-redux'; | |
import { ReduxNetworkProvider } from 'react-native-offline'; | |
let App = () => ( | |
<Navigator> | |
<MainScreen /> | |
<OtherScreen /> | |
</Navigator> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, combineReducers } from 'redux' | |
import { reducer as network } from 'react-native-offline'; | |
const rootReducer = combineReducers({ | |
// ... your other reducers here ... | |
network, | |
}); | |
const store = createStore(rootReducer); | |
export default store; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { all } from 'redux-saga/effects'; | |
import saga1 from './saga1'; | |
import saga2 from './saga2'; | |
import { networkSaga } from 'react-native-offline'; | |
export default function* rootSaga(): Generator<*, *, *> { | |
yield all([ | |
fork(saga1), | |
fork(saga2), | |
fork(networkSaga, { pingInterval: 20000 }), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rootSaga.js | |
import { all } from 'redux-saga/effects'; | |
import saga1 from './saga1'; | |
import saga2 from './saga2'; | |
import { networkSaga } from 'react-native-offline'; | |
export default function* rootSaga(): Generator<*, *, *> { | |
yield all([ | |
fork(saga1), | |
fork(saga2), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Root.js | |
import store from './reduxStore'; | |
import React from 'react'; | |
import { Provider } from 'react-redux'; | |
import { ReduxNetworkProvider } from 'react-native-offline'; | |
let App = () => ( | |
<Navigator> | |
<MainScreen /> | |
<OtherScreen /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// configureStore.js | |
import { createStore, combineReducers } from 'redux' | |
import { reducer as network } from 'react-native-offline'; | |
const rootReducer = combineReducers({ | |
// ... your other reducers here ... | |
network, | |
}); | |
const store = createStore(rootReducer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ShiftBadge = () => { | |
const isOnShift = useIsOnShift() | |
return isOnShift ? ( | |
<View style={styles.container}> | |
<Text style={styles.text}> | |
Currently on shift and receiving reminders | |
</Text> | |
</View> | |
) : ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lastShiftSelector = state => state.shifts.slice(-1)[0] | |
const useIsOnShift = () => { | |
const lastShift = useSelector(lastShiftSelector) | |
const currentTime = useCurrentTime() | |
const [isOnShift, setIsOnShift] = useState(false) | |
useEffect(() => { | |
if (lastShift) { |