-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: react-native "twrnc" and "native-wind" styling types (#1493)
* feat twrnc style type * feat twrnc style type * feat: twrnc test * feat: native wind styling * chore: prettier * chore: added changeset * Update .changeset/strong-cycles-cough.md --------- Co-authored-by: Sami Jaber <[email protected]>
- Loading branch information
Showing
7 changed files
with
199 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@builder.io/mitosis': patch | ||
--- | ||
|
||
Adds two new styling options for the react-native generator: twrnc and native-wind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/core/src/__tests__/data/react-native/twrnc-styled-component.raw.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function MyComponent(props) { | ||
return ( | ||
<div class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"> | ||
<button onClick={(e) => console.log('event')}>Hello</button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
import { componentToReactNative } from '../generators/react-native'; | ||
import { runTestsForTarget } from './test-generator'; | ||
|
||
import { parseJsx } from '..'; | ||
import twrncStyledComponentRN from './data/react-native/twrnc-styled-component.raw.tsx?raw'; | ||
|
||
describe('React Native', () => { | ||
runTestsForTarget({ options: {}, target: 'reactNative', generator: componentToReactNative }); | ||
|
||
test('twrnc style', () => { | ||
const component = parseJsx(twrncStyledComponentRN); | ||
const output = componentToReactNative({ | ||
stylesType: 'twrnc', | ||
})({ component }); | ||
|
||
expect(output).toMatchSnapshot(); | ||
}); | ||
|
||
test('native-wind style', () => { | ||
const component = parseJsx(twrncStyledComponentRN); | ||
const output = componentToReactNative({ | ||
stylesType: 'native-wind', | ||
})({ component }); | ||
|
||
expect(output).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters