您正在公开分享您的应用程序机密

您正在公开分享您的应用程序机密

本文介绍了GetStream.io &React Native TypeError:您正在公开分享您的应用程序机密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在 React Native 中创建一个 getstream 提要应用程序,并且在过去几个小时内一直试图调试此错误,但没有成功.其他人已经在堆栈溢出上发布了它,但没有使用 react-native-activity-feed 中的 <StreamApp></StreapApp> 组件.

I am creating a getstream feed app in react native, and have been trying to debug this error for the past couple hours but with no success. Other's have posted about it on stack overflow but not with using the <StreamApp></StreapApp> component from react-native-activity-feed.

这是我的代码

import config from '../../config';

class Feed extends Component {
  render(){
    return(
      <SafeAreaView
                style={[{ flex: 1 }, { backgroundColor: '#FFFFFF' }]}
                forceInset={{ top: 'always' }}
            >
      <StreamApp
        apiKey={config.stream.app.key}
        appId={config.stream.app.id}
        token={this.state.token}>
          <FlatFeed
            feedGroup="timeline"
            options={{
              limit: 10,
            }}
            notify
            navigation={this.props.navigation}
            Activity={(props) => (
              <TouchableOpacity
                onPress={() => this._onPressActivity(props.activity)}
              >
                <Activity
                  {...props}
                  Footer={
                    <View style={{ flexDirection: 'row', alignItems: 'center' }}>
                      <LikeButton {...props} />

                      <ReactionIcon
                        icon={ReplyIcon}
                        labelSingle="comment"
                        labelPlural="comments"
                        counts={props.activity.reaction_counts}
                        kind="comment"
                      />
                    </View>
                  }
                />
              </TouchableOpacity>
            )}
          />
          </StreamApp>
      </SafeAreaView>
    );
  }
}

我正在从位于我的根目录中的配置文件中导入密钥和 ID.我还尝试将 id 和 key 存储在 .env 文件中,但两种努力都会导致相同的错误.我在服务器端获得的令牌,我没有包含从 AsyncStorage 检索它的代码,所以我不会把帖子弄乱.

I am importing the key and id from a config file located in my root directory. I have also tried storing the id and key in a .env file but both efforts result in the same error. The Token I am getting server-side, I don't include the code for retrieving it from AsyncStorage so I don't clutter the post.

另外,这里是确切的错误:

Also, here is the exact error:

推荐答案

问题在于您如何获取令牌.如果您将令牌存储在状态中,则会出现错误,而如果您从导入密钥和 ID 的同一位置导入它,应用程序将正确加载.

The problem is how you acquire the token. The error comes up if you store the token in the state, whereas if you import it from the same spot as you import the key and ID the app will load correctly.

这篇关于GetStream.io &amp;React Native TypeError:您正在公开分享您的应用程序机密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 08:21