Skip to content

Instantly share code, notes, and snippets.

View IslamRustamov's full-sized avatar
😜
Popping outta wagon escootit

Islam IslamRustamov

😜
Popping outta wagon escootit
  • Krasnodar, Russia
View GitHub Profile
Library for photo compression used as example in presentation:
https://www.npmjs.com/package/react-native-photo-compressor
Article about turbo modules vs platform channel performance (needs VPN)
https://medium.com/@islamrustamov/obj-c-turbo-module-vs-c-turbo-module-vs-flutter-platform-channel-e610a344ec92
Discussion with William Candillon about animation performance
https://github.com/Shopify/react-native-skia/discussions/1824
Example of template for RN project
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:statsfl/statsfl.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
import {
Canvas,
Group,
Rect,
useComputedValue,
mix,
vec,
SkiaValue,
useTiming,
} from '@shopify/react-native-skia';
setCenteredIndex(Math.round(e.nativeEvent.contentOffset.y / blockSize));
const height = Dimensions.get('window').height;
const blockSize = 70;
function ItemSeparator() {
return <View style={{height: 10}} />;
}
function ListSpacer() {
return <View style={{height: height / 2 - blockSize}} />;
interface Article {
title: string;
date: string;
}
// ...
interface ArticleBlockProps extends Article {
isCenter: boolean;
}
Future<void> _sort() async {
try {
double mean = 0;
for (var i = 0; i < 1000; i++) {
final stopwatch = Stopwatch()..start();
await platform.invokeMethod('sort', list10);
stopwatch.stop();
// Don't worry, I converted it to milliseconds afterwards
const sortObjectiveC = async arr => {
let mean = 0;
for (let i = 0; i < 1000; i++) {
const startTime = performance.now();
await RTNSorter?.sort(arr);
const endTime = performance.now();
const sortCPP = arr => {
let mean = 0;
for (let i = 0; i < 1000; i++) {
const startTime = performance.now();
NativeSampleModule.sort(arr);
const endTime = performance.now();
private func sort(result: FlutterResult, _ array: [Int]) {
var arr = array
for _ in 0...arr.count {
for value in 1...arr.count - 1 {
if arr[value-1] > arr[value] {
let largerValue = arr[value-1]
arr[value-1] = arr[value]
arr[value] = largerValue
}
}