question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-primitives Touchable doesn't work

See original GitHub issue

First of all, thanks for this awesome project! I’m investigating how this could work at our company to get more client-facing component building in the design team realm and it seems really viable so far!

Now, I may be wrong about the expected behavior, but I thought that all of the react-primitives would work for react-sketchapp. I wouldn’t expect Touchable to do anything in sketch, but I was hoping that it would transparently render so I could share components with interactions with the web and native.

When I attempt something like this:

import React from 'react';
import { Text, View, Touchable } from 'react-primitives';

const Button = (props) => (
    <Touchable onPress={() => console.log('hi')}>
        <View>
            <Text>{props.children}</Text>
        </View>
    </Touchable>
);

export default Button;

I am getting an error that says:

TypeError: this.touchableGetInitialState is not a function. See the screenshot below:

screen shot 2017-05-22 at 10 08 57 am

It works fine when I render it on the web, so it stands to reason this is not an issue with react-primitives. Let me know if I am expecting something that shouldn’t work at all, but it seems logical to me that Touchable should at least render and not be interactive in Sketch.

I am using Sketch 43.2 and react-sketchapp 0.10.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
theTechiecommented, Aug 13, 2017

Yes. Still not working with 0.4.3. (using CRNA)

"react": "15.4.0",
"react-dom": "15.4.0",
"react-primitives": "^0.4.3",
1reaction
tafelitocommented, Apr 11, 2018

@mathieudutour is this working on react 16.3? I’m having this same issue using v0.5 and react 16.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Up and Running with Universal Components | HackerNoon.com
RP uses the Touchable primitive which doesn't technically map directly to RN. There is a Touchable api in React Native but it's not...
Read more >
React-Native touchable Opacity not work in native-stack
i'm studying about React-Native and have a problem. touchableOpacity Tag doesn't work in native-stack. my code is. Stack.js
Read more >
Hello, styled-components/primitives - Jake Trent
Primitives style cross-platform components. ... View s, Touchable s once and make them renderable via react-dom , react-native , or other ...
Read more >
Themeable components for React & React Native - Bumbag
All components in Bumbag Native are built on top of the <Box> primitive. Any component in Bumbag uses the internals of <Box> ....
Read more >
How to use styled-components with React Native
styled-components is a CSS-in-JS library that is open source and ... in a React Native app, you must import the /native to access...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found