组件未正确更新

时间:2018-09-05 13:56:53

标签: javascript android react-native react-navigation

在我的App中,标题中有一个35x35的视图,该视图的颜色与登录人员的身份颜色相同;除了小故障外,它还像魅力一样起作用

此刻的行为:

我在视图上按(以导航到SelectACDState屏幕)//工作正常

我通过按下它来选择我的新状态,它可以使我导航//正常运行

我回到最初单击状态视图的屏幕

该变量已在globals.js中直接更改,但视图仍显示旧状态颜色(但如果我在tabNavigator中更改为另一个屏幕,则视图将更改为正确的颜色)

App.js:

while ((matched_parameter = pattern.exec(redirect_string)) != null) {
    let redirect_found: boolean = false;
    for (let index in parameters.controls) {
        if (parameters.controls[index].value['key'] == matched_parameter[1]) {
            redirect_found = true;
            break;
        }
    }
    if (!redirect_found && matched_parameter[1] != '') {
            (<FormArray>this.form_group.get('parameters')).controls.unshift(this.form_builder.group({
                "key": matched_parameter[1],
                "internal": false,
                "source": "record",
                "field": "panelist_id",
                "varies_by_status": false
            }));
    }
}

SelectACDState.js:

{all imports}

export default createStackNavigator({

{...}

  Home: {
    navigationOptions: ({ navigation }) => ({
      title: null,
      headerRight: (
        <TouchableOpacity
          style={[
            styles.ACDstateButton,
            (style = { backgroundColor: global.BColor })
          ]}
          onPress={() => {
            navigation.navigate("SelectACDState");
          }}
        />
      )
    }),

{...}

  SelectACDState: {
    screen: SelectACDState,
    navigationOptions: { header: null }
  }
});

0 个答案:

没有答案