-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding support for styling and rendering components on VR platform #755
Comments
I'm good with adding something like this though I'd rather call it // @flow
import * as React from 'react'
export function createCss(StyleSheet) {
// ...
}
type Options = {
getShouldForwardProp: (
Component: React.ElementType
) => (prop: string) => boolean
}
let defaultPickTest = prop => prop !== 'theme' && prop !== 'innerRef'
export function createStyled(
StyleSheet,
{ getShouldForwardProp = () => defaultPickTest }: Options = {}
) {
// ...
} And then it can be used in // @flow
import * as React from 'react'
import { View, Image, Text, StyleSheet } from 'react-primitives'
import {
testPickPropsOnPrimitiveComponent,
testPickPropsOnOtherComponent
} from './test-props'
import { createStyled, createCss } from '@emotion/primitives-core'
function getShouldForwardProp(component: React.ElementType) {
switch (component) {
case View:
case Text:
case Image: {
return testPickPropsOnPrimitiveComponent
}
}
return testPickPropsOnOtherComponent
}
let styled = createStyled(StyleSheet, { getShouldForwardProp })
// ...assign View, Image and Text
export default styled
export let css = createCss(StyleSheet) And we can create a new package, // @flow
import { StyleSheet } from 'react-native'
import { createStyled, createCss } from '@emotion/primitives-core'
let styled = createStyled(StyleSheet)
// ...assign all the components
export default styled
export let css = createCss(StyleSheet) It'd be great if you could submit a PR for this!!
|
Sure! I'll go ahead and create a PR. I'll add |
I'm not totally sure about Maybe instead of adding |
Hm.. I think you're right about this! I'll make changes for
|
The thing is that react-primitives is outdated, right? Maybe you should contact maintainers. |
Haha react-primitives is way behind. It has to do so much work on the core, new primitives, animations and bug fixes. I'll try to contact the maintainers. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
emotion
version:react
version:Relevant code.
What you did:
What happened:
Reproduction:
Problem description:
Using
@emotion/primitives
withreact-360
to style VR apps across the platforms. But,@emotion/primitives
depends onreact-primitives
which when installed inreact-360
project, gives an error thatBut when we try to install
react-vr
, it conflicts withreact-360
.Suggested solution:
We can detach the
css
function from@emotion/primitives
and create a separate package for it, and then use it according to the environment.Something like this:
The text was updated successfully, but these errors were encountered: