React-native-router-flux: احصل على مسار نشط على الدرج

تم إنشاؤها على ٣٠ مايو ٢٠١٦  ·  3تعليقات  ·  مصدر: aksonov/react-native-router-flux

مرحبًا ، أريد إبراز العنصر النشط الحالي على الدرج الخاص بي ، كيف يمكنني الحصول على المشهد / المسار الحالي حتى أتمكن من تمييز العنصر المقابل؟
لقد جربت Actions.currentRouter لكنها غير محددة.

شكرا

question

التعليق الأكثر فائدة

إذا كنت تستخدم المخفض الافتراضي ، يمكنك أيضًا الوصول إلى الحالة الحالية ومن ثم المسار باستخدام:

const reducerCreate = params=>{

    const defaultReducer = Reducer(params);

    return (state, action)=>{


       // The following is an example alternative implementation of Reducer.js .getCurrent(state)
        var currentState = state;

        if(currentState){
          while (currentState.children){
            currentState = currentState.children[currentState.index]
          }
        }

        return defaultReducer(state, action);
    }
};

ال 3 كومينتر

إذا كنت تستخدم redux ، فربما يمكنك التحقق من ذلك للحصول على this.props.route.key .

إذا كنت تستخدم المخفض الافتراضي ، يمكنك أيضًا الوصول إلى الحالة الحالية ومن ثم المسار باستخدام:

const reducerCreate = params=>{

    const defaultReducer = Reducer(params);

    return (state, action)=>{


       // The following is an example alternative implementation of Reducer.js .getCurrent(state)
        var currentState = state;

        if(currentState){
          while (currentState.children){
            currentState = currentState.children[currentState.index]
          }
        }

        return defaultReducer(state, action);
    }
};

سيكون من الجيد إضافته إلى مستندات جزء الدرج

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات