Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redux example - side effect warning #2170

Closed
brycejacobs opened this issue Aug 2, 2017 · 3 comments
Closed

redux example - side effect warning #2170

brycejacobs opened this issue Aug 2, 2017 · 3 comments

Comments

@brycejacobs
Copy link

brycejacobs commented Aug 2, 2017

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.15 (v3 is not supported)
  • react-native v0.47.1

Expected behaviour

No warnings

Actual behaviour

index.ios.bundle:13140 Warning: Cannot update during an existing state transition (such as within render or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to componentWillMount.

It seems that whenever we transition from one tab to another, we get this warning.

Steps to reproduce

const navigator = Actions.create(<Scene key="lightbox" lightbox>
    <Scene key="modal" modal getSceneStyle={getSceneStyle}>
        <Scene key="drawer" drawer hideNavBar contentComponent={NavigationSideBar}>
            <Scene key="root" hideNavBar hideTabBar>
                <Scene key="tabbar" tabs tabBarStyle={styles.tabBarStyle} tabBarSelectedItemStyle={styles.tabBarSelectedItemStyle}>
                    <Scene key={TAB_CONNECTION} initial title="Dash" component={DashView} icon={DashIcon} />
                    <Scene key={TAB_DEVICES} title="Devices" component={DevicesView} icon={DevicesIcon} />
                    <Scene key={TAB_ADDRESSING} title="Addressing" component={AddressingView} icon={AddressingIcon} />
                </Scene>
                <Scene key={VIEW_ANALOG_VALVE} hideNavBar={false} title="Analog Valve" component={AnalogValveView} />
                <Scene key={VIEW_BINARY_DEVICE} hideNavBar={false} title="Binary Device" component={BinaryDeviceView} />
                <Scene
                    key={SWITCHER_FD_COMM.BASE}
                    back
                    hideNavBar
                    >
                    <Scene
                        key={SWITCHER_FD_COMM.FUNC_TYPE}
                        title="Field Device Setup"
                        component={FunctionType}
                        />
                    <Scene
                        key={SWITCHER_FD_COMM.OVERVIEW}
                        title="Field Device Setup"
                        component={FDOverview}
                        />
                </Scene>
                <Scene
                    key={SWITCHER_CONTROLLER_COMM.BASE}
                    back
                    hideNavBar
                    >
                    <Scene
                        key={SWITCHER_CONTROLLER_COMM.EQUIP_TYPE}
                        title="Controller Setup"
                        component={EquipmentType}
                        />
                    <Scene
                        key={SWITCHER_CONTROLLER_COMM.UNIT_NO}
                        title="Controller Setup"
                        component={UnitNumber}
                        />
                    <Scene
                        key={SWITCHER_CONTROLLER_COMM.SUFFIX}
                        title="Controller Setup"
                        component={Suffix}
                        />
                    <Scene
                        key={SWITCHER_CONTROLLER_COMM.OVERVIEW}
                        title="Controller Setup"
                        component={ControllerOverview}
                        />
                </Scene>
            </Scene>
        </Scene>
    </Scene>
</Scene>);

Root render

import Routes from './app/routes';
...

// Init the store
const createStore = require('./app/store').default;
const store = createStore({});

// Root component for the phone app.
const App = () => (
    <Provider store={store}>
        <StyleProvider style={getTheme(commonColor)}>
            <View style={{ flex: 1 }}>
                <Routes />
                <ControllerConnModal />
                <FDConnModal />
            </View>
        </StyleProvider>
    </Provider>
);

AppRegistry.registerComponent('example', () => App);

For non-obvious bugs, please fork this component, modify Example project to reproduce your issue and include link here.

  1. Code above
  2. Transition to another tab view.
  3. Observe console
@aksonov
Copy link
Owner

aksonov commented Aug 3, 2017

How I can run your code above? Modify Redux example here https://github.com/rasmniel/rnrfSample and give me the link.

@aksonov
Copy link
Owner

aksonov commented Aug 3, 2017

For non-obvious bugs, please fork this component, modify Example project to reproduce your issue and include link here.

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2017

Closed due inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants