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

What is the return type of the getSSID() method? #96

Open
vedant17 opened this issue Jul 9, 2019 · 1 comment
Open

What is the return type of the getSSID() method? #96

vedant17 opened this issue Jul 9, 2019 · 1 comment

Comments

@vedant17
Copy link

vedant17 commented Jul 9, 2019

I have used array.map as well as JSON.stringify to find out the contents but still I keep getting the following error.

Invariant Violation: Objects are not valid as a React child (found: object with keys {_40, _65, _55, _72}). If you meant to render a collection of children, use an array instead.
in RCTView (at View.js:45)
in View (at WifiList.js:29)
in WifiList (at SceneView.js:9)
in SceneView (at FluidTransitioner.js:377)
in RCTView (at View.js:45)
in View (at createAnimatedComponent.js:151)
in AnimatedComponent (at screens.native.js:59)
in Screen (at TransitionRouteView.js:45)
in TransitionRouteView (at FluidTransitioner.js:368)
in RCTView (at View.js:45)
in View (at screens.native.js:83)
in ScreenContainer (at TransitionItemsView.js:119)
in RCTView (at View.js:45)
in View (at TransitionItemsView.js:113)
in TransitionItemsView (at FluidTransitioner.js:223)
in RCTView (at View.js:45)
in View (at Transitioner.tsx:267)
in Transitioner (at FluidTransitioner.js:73)
in FluidTransitioner (at createFluidNavigator.js:38)
in FluidNavigationView (at createNavigator.js:61)
in Navigator (at createAppContainer.js:429)
in NavigationContainer (at App.js:22)
in App (at renderApplication.js:35)
in RCTView (at View.js:45)
in View (at AppContainer.js:98)
in RCTView (at View.js:45)
in View (at AppContainer.js:115)
in AppContainer (at renderApplication.js:34)

This error is located at:
in RCTView (at View.js:45)
in View (at WifiList.js:29)
in WifiList (at SceneView.js:9)
in SceneView (at FluidTransitioner.js:377)
in RCTView (at View.js:45)
in View (at createAnimatedComponent.js:151)
in AnimatedComponent (at screens.native.js:59)
in Screen (at TransitionRouteView.js:45)
in TransitionRouteView (at FluidTransitioner.js:368)
in RCTView (at View.js:45)
in View (at screens.native.js:83)
in ScreenContainer (at TransitionItemsView.js:119)
in RCTView (at View.js:45)
in View (at TransitionItemsView.js:113)
in TransitionItemsView (at FluidTransitioner.js:223)
in RCTView (at View.js:45)
in View (at Transitioner.tsx:267)
in Transitioner (at FluidTransitioner.js:73)
in FluidTransitioner (at createFluidNavigator.js:38)
in FluidNavigationView (at createNavigator.js:61)
in Navigator (at createAppContainer.js:429)
in NavigationContainer (at App.js:22)
in App (at renderApplication.js:35)
in RCTView (at View.js:45)
in View (at AppContainer.js:98)
in RCTView (at View.js:45)
in View (at AppContainer.js:115)
in AppContainer (at renderApplication.js:34)
throwOnInvalidObjectType
index.bundle?platform=android&dev=true&minify=false:13681:20
reconcileChildFibers
index.bundle?platform=android&dev=true&minify=false:14379:37
reconcileChildren
index.bundle?platform=android&dev=true&minify=false:15891:50
updateHostComponent
index.bundle?platform=android&dev=true&minify=false:16266:26
performUnitOfWork
index.bundle?platform=android&dev=true&minify=false:20292:27
workLoop
index.bundle?platform=android&dev=true&minify=false:20326:47
renderRoot
index.bundle?platform=android&dev=true&minify=false:20392:21
performWorkOnRoot
index.bundle?platform=android&dev=true&minify=false:21130:23
performWork
index.bundle?platform=android&dev=true&minify=false:21057:30
performSyncWork
index.bundle?platform=android&dev=true&minify=false:21033:20
batchedUpdates$1
index.bundle?platform=android&dev=true&minify=false:21218:28
batchedUpdates
index.bundle?platform=android&dev=true&minify=false:9949:37
_receiveRootNodeIDEvent
index.bundle?platform=android&dev=true&minify=false:10006:23
receiveTouches
index.bundle?platform=android&dev=true&minify=false:10036:34
__callFunction
index.bundle?platform=android&dev=true&minify=false:2577:49

index.bundle?platform=android&dev=true&minify=false:2334:31
__guard
index.bundle?platform=android&dev=true&minify=false:2531:15
callFunctionReturnFlushedQueue
index.bundle?platform=android&dev=true&minify=false:2333:21
callFunctionReturnFlushedQueue
[native code]

Can please some on help me out?

import React, {Component} from 'react'
import {Dimensions, Platform, StyleSheet, Text, View, Button, TextInput, TouchableOpacity, Image, Animated, Easing} from 'react-native'
import { FluidNavigator, Transition } from "react-navigation-fluid-transitions"
import { createStackNavigator, createAppContainer } from "react-navigation"
import { NetworkInfo } from "react-native-network-info"



class WifiList extends Component<Props> {

  constructor () {
    super()
    this.state = {
      data: []
    }
  }
  getWifiList = async () => {
    const ssid = await NetworkInfo.getSSID();
    this.setState({
      data: ssid
    })
    return (
      <Text>{JSON.stringify(ssid)}</Text>
    )
  }

  render () {
    return (
      <View style={styles.container}>
      {this.getWifiList()}
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#FFFFFF',
  }
})

module.exports = WifiList;

This is my code

@pusherman

@hosseinmd
Copy link
Contributor

use this code

import React, {Component} from 'react'
import {Dimensions, Platform, StyleSheet, Text, View, Button, TextInput, TouchableOpacity, Image, Animated, Easing} from 'react-native'
import { FluidNavigator, Transition } from "react-navigation-fluid-transitions"
import { createStackNavigator, createAppContainer } from "react-navigation"
import { NetworkInfo } from "react-native-network-info"



class WifiList extends Component<Props> {

  constructor () {
    super()
    this.state = {
      data: []
    }
  }
  getWifiList = async () => {
    const ssid = await NetworkInfo.getSSID();
    this.setState({
      data: ssid
    })
  }
componentDidMount(){
    this.getWifiList()
}
  render () {
    return (
      <View style={styles.container}>
           <Text>{JSON.stringify(this.state.data)}</Text>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#FFFFFF',
  }
})

module.exports = WifiList;

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

No branches or pull requests

2 participants