Skip to main content

Introduction

⚡️ Flexn Create will help you create a multiplatform app in no time.

💵 Building multiple projects to support different platforms is expensive and time-consuming. Instead, focus on your content and just import components from Flexn Create.

📺 Built-in focus control system allows for better control of your application behavior on the big screen.

System requirements

Installation

Install Flexn Create package and it's peer dependencies

yarn add @flexn/create
yarn add @flexn/shopify-flash-list

Setup

Add this snippet to your MainActivity.java or MainActivity.kt

import io.flexn.create.TvRemoteHandlerModule
import android.view.KeyEvent

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
TvRemoteHandlerModule.getInstance().onKeyEvent(event, "up");

return super.onKeyUp(keyCode, event);
}

@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
TvRemoteHandlerModule.getInstance().onKeyEvent(event, "longPress");

return super.onKeyLongPress(keyCode, event);
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_UP || keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
event.startTracking();
TvRemoteHandlerModule.getInstance().onKeyEvent(event, "down");

return true;
}

TvRemoteHandlerModule.getInstance().onKeyEvent(event, "down");

return super.onKeyDown(keyCode, event);
}