Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
@emotion/native
Advanced tools
Readme
Style and render React Native components using emotion
npm install @emotion/react @emotion/native
or if you use yarn
yarn add @emotion/react @emotion/native
This package also depends on react
, react-native
and prop-types
so make sure you've them installed.
import React from 'react'
import { AppRegistry } from 'react-native'
import styled, { css } from '@emotion/native'
const Container = styled.View`
display: flex;
justify-content: center;
align-items: center;
margin: 50px;
`
const Description = styled.Text({
color: 'hotpink'
})
const Image = styled.Image`
padding: 40px;
`
const emotionLogo = 'https://cdn.rawgit.com/emotion-js/emotion/main/emotion.png'
class App extends React.Component {
render() {
return (
<Container
style={css`
border-radius: 10px;
`}
>
<Description style={{ fontSize: 45, fontWeight: 'bold' }}>
Emotion Primitives
</Description>
<Image
source={{
uri: emotionLogo,
height: 150,
width: 150
}}
/>
</Container>
)
}
}
AppRegistry.registerComponent('ExampleApp', () => App)
Use @emotion/react
for theming support.
import React from 'react'
import styled, { css } from '@emotion/native'
import { ThemeProvider } from '@emotion/react'
const theme = {
color: 'hotpink',
backgroundColor: 'purple'
}
const Container = styled.View`
display: flex;
justify-content: center;
align-items: center;
margin: 50px;
border: 5px solid red;
background-color: ${props => props.theme.backgroundColor};
`
const Description = styled.Text({
color: 'hotpink'
})
const Image = styled.Image`
padding: 40px;
`
const emotionLogo = 'https://cdn.rawgit.com/emotion-js/emotion/main/emotion.png'
class App extends React.Component {
render() {
return (
<ThemeProvider theme={theme}>
<Container
style={css`
border-radius: 10px;
`}
>
<Description style={{ fontSize: 45, fontWeight: 'bold' }}>
Emotion Primitives
</Description>
<Image
source={{
uri: emotionLogo,
height: 150,
width: 150
}}
/>
</Container>
</ThemeProvider>
)
}
}
flex
property works like CSS shorthand, and not the legacy flex
property in React Native. Setting flex: 1
sets flexShrink
to 1
in addition to setting flexGrow
to 1
and flexBasis
to 0
.FAQs
Style and render React Native components using emotion
The npm package @emotion/native receives a total of 99,530 weekly downloads. As such, @emotion/native popularity was classified as popular.
We found that @emotion/native demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.