How to use the react-native-config.CHAT_URL function in react-native-config

To help you get started, we’ve selected a few react-native-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCore / UI / Chat / index.js View on Github external
if (props.isBot !== true) {
      const nationIdX = props.groupDefault
        ? props.groupNationId
        : props.nationId; // hardcode for bitnation chat group
      const selectedNation = resolveNation(props.nations || [], nationIdX);
      if (!selectedNation) {
        if (Platform.OS === "ios") {
          props.navigator.pop();
        } else {
          props.navigator.dismissModal();
        }
        return;
      }
      this.nationId = selectedNation.idInSmartContract;
      // Creating the socket-client instance will automatically connect to the server.
      this.connection = SocketIOClient(config.CHAT_URL, {
        transports: ["websocket"],
        upgrade: false,
        query: `token=${config.AUTH_TOKEN}`
      });
      this.connection.on("connect", () => {
        this.connection.emit("room:join", {
          nation_id: this.nationId,
        });
      });

      this.state = {
        messages: [],
        joined: false
      };
    } else {
      // add initial bot message
github Bit-Nation / BITNATION-Pangea-mobile / src / screens / ChatScreen / index.js View on Github external
constructor(props: Props) {
    super(props);

    if (props.isBot !== true) {
      const selectedNation = resolveNation(props.nations || [], props.nationId);
      if (selectedNation === null) {
        props.navigator.pop();
        return;
      }
      this.nationId = selectedNation.idInSmartContract;
      // Creating the socket-client instance will automatically connect to the server.
      this.connection = SocketIOClient(config.CHAT_URL, {
        transports: ['websocket'],
        upgrade: false,
        query: `token=${config.AUTH_TOKEN}`,
      });
      this.connection.on('connect', () => {
        this.connection.emit('room:join', {
          nation_id: this.nationId,
        });
      });

      this.state = {
        messages: [],
        joined: false,
      };
    } else {
      // add initial bot message
github Bit-Nation / BITNATION-Pangea-mobile / src / screens / ChatScreen / index.js View on Github external
constructor(props: Props) {
    super(props);

    if (props.isBot !== true) {
      const selectedNation = resolveNation(props.nations || [], props.nationId);
      if (selectedNation === null) {
        props.navigator.pop();
        return;
      }
      this.nationId = selectedNation.idInSmartContract;
      // Creating the socket-client instance will automatically connect to the server.
      this.connection = SocketIOClient(config.CHAT_URL, {
        transports: ['websocket'],
        upgrade: false,
        query: `token=${config.AUTH_TOKEN}`,
      });
      this.connection.on('connect', () => {
        this.connection.emit('room:join', {
          nation_id: this.nationId,
        });
      });

      this.state = {
        messages: [],
        joined: false,
      };
    } else {
      // add initial bot message
github Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCore / UI / Chat / index.js View on Github external
componentDidMount() {
    if (this.props.isBot !== true && this.connection) {
      this.props.showSpinner();
      // load initial messages
      const URL = `${config.CHAT_URL}/messages/${this.nationId}?auth_token=${
        config.AUTH_TOKEN
      }`;
      fetch(URL)
        .then(response => response.json())
        .then(
          json => {
            const messages = deprecatedCreateGiftedChatMessageObject(
              json.reverse()
            );
            this.props.hideSpinner();
            this.setState(previousState => ({
              messages: GiftedChat.append(previousState.messages, messages)
            }));
          },
          () => {
            this.props.hideSpinner();