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

Does this work with expo RN apps? #43

Closed
kylegillen opened this issue Jun 29, 2019 · 3 comments
Closed

Does this work with expo RN apps? #43

kylegillen opened this issue Jun 29, 2019 · 3 comments

Comments

@kylegillen
Copy link

Hi.
I've followed the setup as per the docs and tried some other variations, all to no avail.

Any reason why this shouldn't work?

Here's my App.tsx file:

import React from 'react'
import { StyleSheet, Text, View, Button } from 'react-native'

if (process.env.NODE_ENV !== 'production') {
  const whyDidYouRender = require('@welldone-software/why-did-you-render/dist/no-classes-transpile/umd/whyDidYouRender.min.js')
  whyDidYouRender(React)
}

const { useState } = React

const TestComp = () => {
  const [visible, setVisible] = useState(false)
  return (
    <View>
      {visible && (
        <View>
          <Text>Is Visible</Text>
        </View>
      )}
      <Button
        title="Press Me!"
        onPress={() => {
          setVisible(true)
        }}
      />
    </View>
  )
}

TestComp.whyDidYouRender = true

const App = () => {
  return (
    <View style={styles.container}>
      <TestComp />
    </View>
  )
}

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

export default App


@vzaidman
Copy link
Collaborator

TestComp doens't looks like a component that would re-render.
to trigger it, try setting isVisible to false on click (temporary, to test the library)

@vzaidman
Copy link
Collaborator

the app reports only re-renders that can be omitted to the specific components you mark. this specific component doesnt looks like one with redundant re-renders

@vzaidman
Copy link
Collaborator

vzaidman commented Sep 9, 2019

You are free to re-open the issue if you manage to provide extra information, or even better- a sandbox.

@vzaidman vzaidman closed this as completed Sep 9, 2019
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