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

Yellowbox warning when running basic app with Expo / RN #20

Closed
dabit3 opened this issue Feb 21, 2024 · 3 comments
Closed

Yellowbox warning when running basic app with Expo / RN #20

dabit3 opened this issue Feb 21, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@dabit3
Copy link

dabit3 commented Feb 21, 2024

Describe the issue

I'm testing out the library in a bare Expo project.

When running the app, the following warning / error is logged:

iOS Bundled 29ms (node_modules/expo/AppEntry.js)
 ERROR  Warning: Failed prop type: Invalid prop `position` of value `static` supplied to `Text`, expected one of ["absolute","relative"].
Bad object: {
  "fontSize": 24,
  "fontWeight": "bold",
  "position": "static",
  "userSelect": "auto",
  "padding": 10,
  "flexShrink": 1
}

This is my codebase:

import { css, html } from 'react-strict-dom';
import { LogBox } from 'react-native';
LogBox.ignoreLogs(['Failed prop type'])

const styles = css.create({
  container: {
    display: 'flex',
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center',
    borderTopWidth: 1
  },
  h1: { padding: 10 },
  button: {
    borderRadius: 20,
    backgroundColor: '#700fad',
    padding: 10,
    paddingLeft: 50,
    paddingRight: 50
  },
  buttonText: { 
    color: 'white',
    position: 'relative',
    fontWeight: 'bold'
  }
});

export default function App() {
  return (
    <html.div style={styles.container}>
      <html.h1 style={styles.h1}>Hello World</html.h1>
      <html.button
        style={styles.button}
        onClick={() => alert('Hello World')}
      >
        <html.p
          style={styles.buttonText}
        >
          Click me
        </html.p>
      </html.button>
    </html.div>
  );
}

Expected behavior

No error / wraning

Steps to reproduce

steps to reproduce are outlined in the steps in this repo:

https://github.com/dabit3/react-strict-dom-example/blob/main/tokens.stylex.js

Test case

No response

Additional comments

No response

@dabit3 dabit3 added the bug Something isn't working label Feb 21, 2024
@ecreeth
Copy link
Contributor

ecreeth commented Feb 21, 2024

There's a PR that aims to fix this: facebook/react-native#43119

@necolas
Copy link
Contributor

necolas commented Feb 21, 2024

Certain features like position:static (which is used in the internals to match web defaults) require the use of canary React Native, the Fabric architecture, and various feature flags enabled. COMPATIBILITY.md says:

NOTE: React Native support assumes use of React Native's "Fabric" architecture, and relevant feature flags enabled.

The React Native team is working on rolling out the new architecture to OSS, and on simplifying the use of feature flags in the future. For the time being React Native is still in a transitional state and that's the main reason this library is marked as "experimental".

I'm happy to keep open a more general issue (#21) about improving and documenting how React Native web capabilities can be configured for OSS users. It will help surface the need for improved documentation and ergonomics to the React Native team. Input from the community will be very valuable in this regard.

For other Expo-related configuration that's required for xplat support, please refer to this repo's example app: https://github.com/facebook/react-strict-dom/tree/main/apps/examples

@necolas necolas closed this as completed Feb 21, 2024
@necolas
Copy link
Contributor

necolas commented Feb 21, 2024

#21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants