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

add composite components to template #16

Merged
merged 10 commits into from
May 25, 2022
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,7 @@
"**/@lightningjs/cli/**"
]
},
"dependencies": {}
"dependencies": {
"@types/lodash.throttle": "^4.1.7"
}
}
251 changes: 228 additions & 23 deletions packages/harness/renative.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"extendsTemplate": "renative.json",
"engines": {
"@rnv/engine-lightning": "source:rnv",
"@rnv/engine-rn": "source:rnv",
"@rnv/engine-rn-electron": "source:rnv",
"@rnv/engine-rn-next": "source:rnv",
"@rnv/engine-rn-tvos": "source:rnv",
"@rnv/engine-rn-web": "source:rnv",
"@rnv/engine-rn-windows": "source:rnv"
},
"projectName": "app-harness",
"workspaceID": "flexn",
"currentTemplate": "@flexn/template",
"paths": {
"appConfigsDir": "./appConfigs",
"entryDir": "./",
Expand All @@ -15,12 +22,9 @@
}
}
},
"templates": {
"@flexn/template": {
"version": "0.13.2"
}
},
"defaults": {
"title": "Template App",
"id": "io.flexn.template.app",
"supportedPlatforms": [
"android",
"androidtv",
Expand All @@ -31,35 +35,236 @@
"linux",
"firetv",
"chromecast",
"androidwear"
"androidwear",
"tizen"
]
},
"isMonorepo": true,
"plugins": {
"@sentry/react-native": "source:flexn",
"@sentry/react": "source:flexn",
"@sentry/tracing": "source:flexn",
"@react-navigation": "source:flexn",
"react-native-screens": "source:flexn",
"react-native-safe-area-context": "source:flexn",
"react-native-gesture-handler": "source:flexn",
"react-native-google-cast": "source:flexn",
"@flexn/sdk": {
"version": "0.13.2",
"webpack": {
"modulePaths": true,
"moduleAliases": true
},
"tvos": {
"podName": "FlexnSDK"
},
"androidtv": {
"package": "io.flexn.sdk.FlexnSdkPackage",
"projectName": "flexn-io-sdk",
"activityImports": [
"io.flexn.sdk.TvRemoteHandlerModule",
"android.view.KeyEvent;"
],
"activityMethods": [
"override fun dispatchKeyEvent(event: KeyEvent): Boolean {",
" if (event.action == KeyEvent.ACTION_DOWN || event.action == KeyEvent.ACTION_UP) {",
" TvRemoteHandlerModule.getInstance().onKeyEvent(event);",
" }",
" return super.dispatchKeyEvent(event);",
"}"
]
},
"firetv": {
"package": "io.flexn.sdk.FlexnSdkPackage",
"projectName": "flexn-io-sdk",
"activityImports": [
"io.flexn.sdk.TvRemoteHandlerModule",
"android.view.KeyEvent;"
],
"activityMethods": [
"override fun dispatchKeyEvent(event: KeyEvent): Boolean {",
" if (event.action == KeyEvent.ACTION_DOWN || event.action == KeyEvent.ACTION_UP) {",
" TvRemoteHandlerModule.getInstance().onKeyEvent(event);",
" }",
" return super.dispatchKeyEvent(event);",
"}"
]
}
},
"@rnv/renative": "source:flexn",
"react-native": "source:rnv",
"react-native-web": "source:rnv",
"react-native-tvos": "source:rnv",
"react-native-windows": "source:rnv",
"react-native-vector-icons": "source:flexn",
"@lightningjs/sdk": "source:flexn",
"react-native-carplay": "source:flexn",
"react-native-snap-carousel": "3.9.1",
"@lightningjs/cli": "source:flexn",
"react": "source:rnv",
"react-art": "source:rnv",
"react-dom": "source:rnv",
"react-native": "source:rnv",
"@react-native-community/cli-platform-ios": "source:rnv",
"@react-native-community/cli": "source:rnv",
"react-native-tvos": "source:rnv",
"react-native-web": "source:rnv",
"next": "source:rnv"
"next": "source:rnv",
"@react-native-windows/cli": "source:rnv",
"@react-navigation": "source:flexn",
"react-native-screens": "source:flexn",
"react-native-safe-area-context": "source:flexn",
"react-native-google-cast": "source:flexn",
"react-native-reanimated": "source:flexn",
"react-native-gesture-handler": "source:flexn",
"react-native-media-query": "source:flexn",
"@flexn/typescript": "source:flexn",
"tslib": "source:flexn",
"@sentry/react-native": "source:flexn",
"@sentry/react": "source:flexn",
"@sentry/tracing": "source:flexn",
"react-native-carplay": "source:flexn",
"react-native-snap-carousel": "3.9.1"
},
"platforms": {
"android": {
"targetSdkVersion": 30,
"compileSdkVersion": 30,
"reactNativeEngine": "hermes",
"enableAndroidX": true,
"gradle.properties": {
"android.useDeprecatedNdk": true,
"android.enableJetifier": true,
"android.useAndroidX": true,
"android.debug.obsoleteApi": true,
"org.gradle.jvmargs": "-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8",
"org.gradle.daemon": true,
"org.gradle.parallel": true,
"org.gradle.configureondemand": true
},
"AndroidManifest": {
"children": [
{
"tag": "application",
"android:name": ".MainApplication",
"android:usesCleartextTraffic": true,
"tools:targetApi": 28
}
]
},
"mainActivity": {
"onCreate": "super.onCreate(null)"
}
},
"androidtv": {
"engine": "engine-rn-tvos",
"reactNativeEngine": "hermes",
"targetSdkVersion": 30,
"compileSdkVersion": 30,
"enableAndroidX": true,
"gradle.properties": {
"android.useDeprecatedNdk": true,
"android.enableJetifier": true,
"android.useAndroidX": true,
"android.debug.obsoleteApi": true,
"org.gradle.jvmargs": "-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8",
"org.gradle.daemon": true,
"org.gradle.parallel": true,
"org.gradle.configureondemand": true
},
"AndroidManifest": {
"children": [
{
"tag": "application",
"android:name": ".MainApplication",
"android:usesCleartextTraffic": true,
"tools:targetApi": 30
}
]
},
"mainActivity": {
"onCreate": "super.onCreate(null)"
}
},
"firetv": {
"engine": "engine-rn-tvos",
"targetSdkVersion": 30,
"compileSdkVersion": 30,
"reactNativeEngine": "hermes",
"enableAndroidX": true,
"gradle.properties": {
"android.useDeprecatedNdk": true,
"android.enableJetifier": true,
"android.useAndroidX": true,
"android.debug.obsoleteApi": true,
"org.gradle.jvmargs": "-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8",
"org.gradle.daemon": true,
"org.gradle.parallel": true,
"org.gradle.configureondemand": true
},
"AndroidManifest": {
"children": [
{
"tag": "application",
"android:name": ".MainApplication",
"android:usesCleartextTraffic": true,
"tools:targetApi": 30
}
]
},
"mainActivity": {
"onCreate": "super.onCreate(null)"
}
},
"ios": {
"engine": "engine-rn",
"reactNativeEngine": "hermes"
},
"web": {
"engine": "engine-rn-next",
"webpackConfig": {
"nextTranspileModules": [
"lodash-es"
]
}
},
"chromecast": {
"engine": "engine-rn-next",
"webpackConfig": {
"nextTranspileModules": [
"lodash-es"
]
}
},
"tizen": {
"engine": "engine-lightning",
"target": "es5"
},
"webos": {
"engine": "engine-lightning",
"target": "es5"
},
"tvos": {
"engine": "engine-rn-tvos"
},
"macos": {
"engine": "engine-rn",
"excludedPlugins": ["react-native-linear-gradient"]
"excludedPlugins": [
"react-native-linear-gradient"
]
},
"windows": {
"engine": "engine-rn-windows"
},
"xbox": {
"engine": "engine-rn-windows"
}
},
"permissions": {
"ios": {},
"android": {
"INTERNET": {
"key": "android.permission.INTERNET",
"security": "normal"
},
"SYSTEM_ALERT_WINDOW": {
"key": "android.permission.SYSTEM_ALERT_WINDOW",
"security": "signature"
}
}
},
"extendsTemplate": "renative.json",
"currentTemplate": "@flexn/template",
"templates": {
"@flexn/template": {
"version": "0.13.2"
}
}
}
2 changes: 1 addition & 1 deletion packages/harness/src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Entry = () => {
}}
>
{/* initialRouteName="*" */}
<RootStack.Navigator screenOptions={{ headerShown: false }}>
<RootStack.Navigator screenOptions={{ headerShown: false }} initialRouteName="Row">
<RootStack.Screen name="root" component={ScreenHome} />
{Object.entries({
...(!isFactorDesktop ? FocusTestScreens : {}), // don't add focus test screens to navigation for macos/windows platforms (react-native-gesture-handler is not supported yet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function generateData(width, height, items = 30) {
for (let index = 0; index < items; index++) {
temp.push({
index,
backgroundImage: `https://placekitten.com/${width + index}/${height + index}`,
backgroundImage: `https://placekitten.com/${width + index}/${height}`,
// title: `${kittyNames[interval()]} ${kittyNames[interval()]} ${kittyNames[interval()]}`,
});
}
Expand All @@ -22,19 +22,19 @@ function generateData(width, height, items = 30) {

export default class Grid extends Lightning.Component {
static _template() {
const data = generateData(400, 250);
const data = generateData(400, 250, 27);

return {
w: 1920,
h: 1080,
x: 50,
y: 50,
x: 0,
y: 0,
Grid: {
type: FlexnGrid,
data,
itemSpacing: 30,
itemsInViewport: 6,
card: {
w: 250,
h: 250,
},
focusOptions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function generateData(width, height, items = 30) {
for (let index = 0; index < items; index++) {
temp.push({
index,
backgroundImage: `https://placekitten.com/${width + index}/${height + index}`,
backgroundImage: `https://placekitten.com/${width + index}/${height}`,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function generateData(width, height, items = 30) {
for (let index = 0; index < items; index++) {
temp.push({
index,
backgroundImage: `https://placekitten.com/${width + index}/${height + index}`,
backgroundImage: `https://placekitten.com/${width + index}/${height}`,
title: `${kittyNames[interval()]} ${kittyNames[interval()]} ${kittyNames[interval()]}`,
});
}
Expand All @@ -26,6 +26,7 @@ export default class Press extends Lightning.Component {
return {
rowTitle: kittyNames[interval()],
items: generateData(400, 250),
itemsInViewport: interval(3, 8),
};
});

Expand All @@ -39,7 +40,6 @@ export default class Press extends Lightning.Component {
data,
itemSpacing: 30,
card: {
w: 250,
h: 250,
},
row: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function generateData(width, height, items = 30) {
for (let index = 0; index < items; index++) {
temp.push({
index,
backgroundImage: `https://placekitten.com/${width + index}/${height + index}`,
backgroundImage: `https://placekitten.com/${width + index}/${height}`,
title: `${kittyNames[interval()]} ${kittyNames[interval()]} ${kittyNames[interval()]}`,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function generateData(width, height, items = 30) {
for (let index = 0; index < items; index++) {
temp.push({
index,
backgroundImage: `https://placekitten.com/${width + index}/${height + index}`,
backgroundImage: `https://placekitten.com/${width + index}/${height}`,
title: `${kittyNames[interval()]} ${kittyNames[interval()]} ${kittyNames[interval()]}`,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function generateData(width, height, items = 30) {
for (let index = 0; index < items; index++) {
temp.push({
index,
backgroundImage: `https://placekitten.com/${width + index}/${height + index}`,
backgroundImage: `https://placekitten.com/${width + index}/${height}`,
title: `${kittyNames[interval()]} ${kittyNames[interval()]} ${kittyNames[interval()]}`,
});
}
Expand Down
Loading